import axios from '../libs/api.request'

// 根据项目id获取resId或者规则下拉list
export const getResInfo = params => {
  const { projectId, resType } = params
  return axios.request({
    url: `project/${projectId}/resource`,
    method: 'get',
    params: {
      resType,
      projectId
    }
  })
}

// 获取决策流内容
export const getDecisionFlowContent = params => {
  const { projectId, resId } = params
  return axios.request({
    url: `project/${projectId}/resource/${resId}/content`,
    method: 'get',
    params
  })
}

// 保存决策流的内容
export const saveDecisionFlowContent = (params) => {
  const { projectId, resId } = params
  return axios.request({
    url: `project/${projectId}/resource/${resId}/content`,
    method: 'put',
    data: params
  })
}

// 测试资源的内容
export const testDecisionFlowContent = (params) => {
  const { projectId, resId } = params
  return axios.request({
    url: `project/${projectId}/resource/${resId}/content`,
    method: 'post',
    data: params
  })
}
